home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr04
/
fntf16ed.zip
/
FONT16ED.BAS
Wrap
BASIC Source File
|
1993-07-01
|
10KB
|
339 lines
$STACK 4000
$DYNAMIC
DEFINT A-Z
CLS
DD% = FREEFILE
F$ = COMMAND$
IF F$ <= " " THEN
CLS
PRINT " LOAD FONT NAME FROM COMMAND LINE, REQUIRES MOUSE"
DELAY 6
END
END IF
SHARED LL$,MouseReady%,FontPoint%,KK$(),FontBuffer$
DIM KK$(17)
LL$ = SPACE$(16)
MouseReady% = MouseInitialize%
IF MouseReady% = 0 THEN
CLS
PRINT " LOAD FONT NAME FROM COMMAND LINE, REQUIRES MOUSE"
DELAY 6
END
END IF
OPEN F$ FOR RANDOM AS #DD% LEN = 16
field #dd%, 16 as FontBuffer$
FontPoint% = 1
COLOR 7,1
LOCATE 1,1
PRINT SPACE$(80);
LOCATE 1,3
PRINT "PUBLIC Domain Font Editor for 16 X 8 VGA Fonts by Paul Propst";
LOCATE 3,1
PRINT "IN SCAN MODE ";
COLOR 7,0
LOCATE 24,1
PRINT "F1=EDIT ESC=DONE/EXIT UP AND DOWN = CHANGE CHARACTER";
DO
LOCATE 23,1
PRINT SPACE$(10);
LOCATE 23,1
PRINT "CHAR=";FontPoint%;
get #dd%, FontPoint%
LL$ = FontBuffer$
COLOR 7,1
FOR X% = 1 TO 16
T? = asc(MID$(LL$,X%,1))
ut% = t?
KK$(X%) = RIGHT$("00000000" + BIN$(ut%),8)
'LOCATE X% + 5,50
'PRINT KK$(X%),tu%;
locate 5 + x% , 10+1
print space$(8);
FOR Y% = 1 TO 8
LOCATE 5 + X%,10 + Y%
IF MID$(KK$(X%),Y%,1) = "1" THEN PRINT CHR$(178);
NEXT Y%
NEXT X%
COLOR 7,0
CALL GetCharIn(Char1$,Char2$,MRow%,MCol%)
p$ = CHAR1$ + CHAR2$
IF len(p$) = 2 THEN
ju$ = right$(p$,1)
select case asc(ju$)
case 72
decr FontPoint%
case 80
incr FontPoint%
END select
IF (FontPoint% > 256) THEN FontPoint% = 1
IF (FontPoint% < 1) THEN FontPoint% = 256
LOCATE 23,1
PRINT SPACE$(10);
LOCATE 23,1
PRINT "CHAR=";FontPoint%;
IF JU$ = CHR$(59) THEN CALL EditChar
' lset FontBuffer$ = ll$
' put #dd%, FontPoint%
else
IF p$ = chr$(27) THEN
CLS
CLOSE
END
END IF
END IF
LOOP
END
SUB EditChar
SHARED LL$
SHARED FontBuffer$,DD%
'LOCAL T?
COLOR 7,1
CALL MouseHorizontalRange (11,18)
CALL MouseVerticalRange (6,21)
LOCATE 3,1
PRINT "IN EDIT MODE ";
DONEEDIT = 0
WHILE NOT DONEEDIT
DELAY .15
CALL GetCharIn(Char1$,Char2$,MRow%,MCol%)
IF CHAR1$ = CHR$(13) THEN
GSCR% = SCREEN(MRow%,MCol%)
SELECT CASE GSCR%
CASE 178
LOCATE MRow%,MCol%
PRINT CHR$(32);
CASE 32
LOCATE MRow%,MCol%
PRINT CHR$(178);
END SELECT
END IF
IF CHAR1$ = CHR$(27) THEN
DONEEDIT = -1
END IF
WEND
COLOR 7,0
FOR X% = 1 TO 16
KK$(X%) = STRING$(16,0)
FOR Y% = 1 TO 8
AA% = X% + 5
BB% = Y% + 10
LOCATE AA%, BB%
TSCR% = SCREEN(AA%,BB%)
IF TSCR% = 178 THEN MID$(KK$(X%),Y%,1) = "1" ELSE_
MID$(KK$(X%),Y%,1) = "0"
NEXT Y%
NN$ = "&B" + KK$(X%)
MID$(LL$,X%,1) = CHR$(VAL(NN$))
LOCATE X% + 5, 50
PRINT KK$(X%);
NEXT X%
Lset FontBuffer$ = LL$
put #dd%, FontPoint%
DELAY .5
LOCATE 3,1
PRINT "IN SCAN MODE ";
COLOR 7,0
END SUB
'+-------------------------------------------------------------------------+
'| NAME: MouseInitialize% |
'| PURPOSE: Find out IF a mouse driver is active |
'| |
'| SOURCE: Written by Erik Olson |
'+-------------------------------------------------------------------------+
FUNCTION MouseInitialize% PUBLIC
REG 1,0
CALL INTERRUPT &H33
MouseInitialize%=REG(1)
END FUNCTION
'+-------------------------------------------------------------------------+
'| NAME: MouseInformation |
'| PURPOSE: Find mouse location and button status |
'| |
'| SOURCE: Written by Erik Olson |
'+-------------------------------------------------------------------------+
SUB MouseInformation(Rgt%, Lft%, Row%, Col%) PUBLIC
REG 1,3
CALL INTERRUPT &H33
SELECT CASE REG(2)
CASE 1
Lft%=1
CASE 2
Rgt%=1
CASE 3
Lft%=1
Rgt%=1
END SELECT
Row%=REG(4) \ 8 + 1
Col%=REG(3) \ 8 + 1
END SUB
'+-------------------------------------------------------------------------+
'| NAME: MouseMoveCursor |
'| PURPOSE: Directly command mouse location |
'| |
'| SOURCE: Written by Erik Olson |
'+-------------------------------------------------------------------------+
SUB MouseMoveCursor (Byval Row%,Byval Col%) PUBLIC
REG 4, 8 * (Row% - 1)
REG 3, 8 * (Col% - 1)
REG 1, 4
CALL INTERRUPT &H33
END SUB
'+-------------------------------------------------------------------------+
'| NAME: MouseTimesPressed |
'| PURPOSE: Get last button pressed and status. Get screen location of |
'| mouse cursor |
'| SOURCE: Written by Erik Olson |
'+-------------------------------------------------------------------------+
SUB MouseTimesPressed (Byval Button%, NumberTimes%, Row%, Col%) PUBLIC
REM Button% should be 0 to return left button info, 1 for right
REG 2, Button%
REG 1, 5
CALL INTERRUPT &H33
NumberTimes% = REG(2)
Row% = REG(4) \ 8 + 1 ' comment out \8+1 for graphics screens
Col% = REG(3) \ 8 + 1
END SUB
'+-------------------------------------------------------------------------+
'| NAME: MouseHorizontalRange |
'| PURPOSE: Limit mouses horizontal range to specified range and |
'| location |
'| SOURCE: Written by Erik Olson |
'+-------------------------------------------------------------------------+
SUB MouseHorizontalRange (Byval Rgt%,Byval Lft%) PUBLIC
REG 3, 8 * (Rgt% - 1) ' REG 3,Rgt% for graphics screens
REG 4, 8 * (lft% - 1) ' REG 4,Lft% for graphics screens
REG 1, 7
CALL INTERRUPT &H33
END SUB
'+-------------------------------------------------------------------------+
'| NAME: MouseVerticalRange |
'| PURPOSE: Limit mouse verticle range to specified range and |
'| locarion |
'| SOURCE: Written by Erik Olson |
'+-------------------------------------------------------------------------+
SUB MouseVerticalRange (Byval Top%,Byval Bot%) PUBLIC
REG 3, 8 * (Top% - 1) ' REG 3,Top% for graphics screens
REG 4, 8 * (Bot% - 1) ' REG 4,Bot% for graphics screens
REG 1, 8
CALL INTERRUPT &H33
END SUB
'+-------------------------------------------------------------------------+
'| NAME: GetCharIn |
'| PURPOSE: Get character and mouse position. Provide limited |
'| translation of button presses to characters |
'| SOURCE: Original code written by Paul Propst |
'+-------------------------------------------------------------------------+
SUB GetCharIn(Char1$,Char2$,MRow%,MCol%) PUBLIC
SHARED MouseDelay!
LOCAL IsVisible%,CursTop%,CursBot%,Row%,Col%,Rgt%, Lft%
LOCAL Temp$,Button%, NumberTimes%,LastRow%,LastCol%
Char1$ = ""
Char2$ = ""
' Process Mouse
IF (MouseReady% <> 0) THEN
NumberTimes% = 0
' CALL MouseTimesPressed (Button%, NumberTimes%, Row%, Col%)
CALL MouseInformation (Rgt%, Lft%, Row%, Col%)
CALL GetCursParams(IsVisible%,CursTop%,CursBot%)
LOCATE Row%,Col%,1,1,16
Rgt% = 0
Lft% = 0
LastRow% = Row%
LastCol% = Col%
DO
Rgt% = 0
Lft% = 0
CALL MouseInformation (Rgt%, Lft%, Row%, Col%)
'locate 2,10:PRINT Rgt%, Lft%;
LastRow% = Row%
LastCol% = Col%
LOCATE Row%,Col%,1,1,16
IF (Rgt% <> 0) THEN EXIT LOOP
IF (Lft% <> 0) THEN EXIT LOOP
IF INSTAT THEN EXIT LOOP
LOOP ' UNTIL NumberTimes%
IF Rgt% THEN Char1$ = chr$(27)
IF Lft% THEN Char1$ = chr$(13)
IF Rgt% OR Lft% THEN DELAY MouseDelay!
MRow% = Row%
MCol% = Col%
END IF
' Process Keyboard
DO
IF Char1$ > "" THEN EXIT LOOP
IF Char2$ > "" THEN EXIT LOOP
WHILE NOT INSTAT
WEND
IF INSTAT THEN Temp$ = INKEY$
IF LEN(Temp$) = 1 THEN
Char1$ = Temp$
Char2$ = ""
EXIT LOOP
END IF
IF LEN(Temp$) = 2 THEN
Char1$ = CHR$(0)
Char2$ = RIGHT$(Temp$,1)
EXIT LOOP
END IF
LOOP
IF (MouseReady% <> 0) THEN LOCATE Row%,Col%,CursTop%,CursBot%
END SUB
'+-------------------------------------------------------------------------+
'| NAME: GetCursParams |
'| PURPOSE: Get the current cursor size and visibility |
'| |
'| SOURCE: Original code written by Paul Propst |
'+-------------------------------------------------------------------------+
SUB GetCursParams(IsVisible%,CursTop%,CursBot%) PUBLIC SHARED
CursTop% = pbvCursor1
CursBot% = pbvCursor2
IF (pbvCursorVis <> 0) THEN IsVisible% = -1 ELSE IsVisible% = 0
END SUB
'+-------------------------------------------------------------------------+
'| NAME: FileThere% |
'| PURPOSE: Does at least on file of the file spec exist |
'| |
'| SOURCE: Generic since Ver 2.1f |
'+-------------------------------------------------------------------------+
FUNCTION FileThere%(FileSpec$) PUBLIC SHARED
LOCAL af$
FileThere% = 0 'pbvZero
af$ = dir$(FileSpec$)
IF af$ > "" THEN FileThere% = -1 ' pbvMinusOne
END FUNCTION